package com.bootdo.system.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bootdo.common.utils.DateUtils;
import com.bootdo.system.domain.TbUserWeixinPayOrder;
import com.bootdo.system.mapper.TbUserWeixinPayOrderMapper;
import com.bootdo.system.service.WxPayOrderService;


@Service
public class WxPayOrderServiceImpl implements WxPayOrderService{
	
	@Autowired
	TbUserWeixinPayOrderMapper pm;

	@Override
	public int insert2update(TbUserWeixinPayOrder table) {
		int res=0;
		if(table != null) {
			Long id = table.getId();
			if(id != null) {
				table.setUpdateTime(DateUtils.format(new Date()));
				res=pm.updateByPrimaryKeySelective(table);
			}else {
				table.setCreateTime(DateUtils.format(new Date()));
				res=pm.insertSelective(table);
			}
		}
		return res;
	}

	@Override
	public TbUserWeixinPayOrder getById(Long id) {
		return pm.selectByPrimaryKey(id);
	}

}
